//
//  CheckPeopleVC.m
//  EJLX
//
//  Created by adc on 15/11/12.
//  Copyright © 2015年 江苏一键联信息科技有限公司. All rights reserved.
//

#import "CheckPeopleVC.h"
#import "addUserInfoVC.h"
#import "PostImageOfPersonCardVC.h"
#import "PhotoImangVC.h"
#import "ErWeiMaViewController.h"
@interface CheckPeopleVC ()

@end

@implementation CheckPeopleVC
-(void)viewWillAppear:(BOOL)animated{
    self.navigationController.navigationBarHidden = YES;
    [HttpsManager wanShancomplection:^(int genRen, int diZhi, int img) {
        
        _userStr =(genRen ==1)? @"已完善":@"未填写";
        _bankStr =(diZhi ==1)? @"已完善":@"未填写";
        _imgStr =(img ==1)? @"已完善":@"未填写";
        [_tableView reloadData];
        
    }];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
     [self creatNav];
   
    [self addTableView];
    
   
    
    
   
    
}

-(void)creatNav{
    UIView *navView = [[UIView alloc] initWithFrame:CGRectMake(0, 20, WIDE, 44)];
    navView.backgroundColor = RGB_COLOR(0x00c49f);
    [self.view addSubview:navView];
    
    UIButton *leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    leftBtn.frame = CGRectMake(10, 7, 30, 30);
    leftBtn.layer.cornerRadius = 20;
    [leftBtn setImage:[UIImage imageNamed:@"返回箭头"] forState:UIControlStateNormal] ;
    [leftBtn addTarget:self action:@selector(backBtn) forControlEvents:UIControlEventTouchUpInside];
    [navView addSubview:leftBtn];
    
    UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(WIDE/2-60, 7, 120, 30  )];
    title.text = @"资料审核";
    title.textAlignment = NSTextAlignmentCenter;
    title.textColor = [UIColor whiteColor];
    [navView addSubview:title];
    
}

-(void)backBtn{
    [self.navigationController popViewControllerAnimated:YES];
}
-(void)btnClick:(UIButton *)btn{
    
    [self.navigationController popViewControllerAnimated:YES];
    if (btn.tag==104)
    {
        ErWeiMaViewController*ew=[[ErWeiMaViewController alloc]init];
        [self.navigationController pushViewController:ew animated:YES];
    }
}

-(void)addTableView{
    //self.view.backgroundColor = [UIColor lightGrayColor];
    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 70, WIDE, 44*3) style:UITableViewStylePlain];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.scrollEnabled = NO;
    [self.view addSubview:_tableView];
    if ([_tableView respondsToSelector:@selector(setLayoutMargins:)]) {
        [_tableView setLayoutMargins:UIEdgeInsetsZero];
    }
    if ([_tableView respondsToSelector:@selector(setSeparatorInset:)]) {
        [_tableView setSeparatorInset:UIEdgeInsetsZero];
    }
    
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 3;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
   UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell"];
    }
      cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.textLabel.text= @[@"个人资料",@"银行卡提交",@"照片"][indexPath.row];
//    if ([_userStr length]) {
//        cell.detailTextLabel.text = _userStr;
//    }else{
//        cell.detailTextLabel.text = @"未填写";
//    }
    switch (indexPath.row) {
        case 0:
    
                cell.detailTextLabel.text = _userStr;
 
            break;
            
        case 1:
           cell.detailTextLabel.text = _bankStr;
      
        case 2:
           
                cell.detailTextLabel.text = _imgStr;
                
            
            break;
            break;
        default:
            break;
    }
    
    
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {
        addUserInfoVC *peopleInfo = [[addUserInfoVC alloc] init];
//        peopleInfo.returnBlock = ^(NSString *str){
//            self.userStr = str;
//            [tableView reloadData];
//        };
        [self.navigationController pushViewController:peopleInfo animated:YES];
    }else if (indexPath.row == 1){
        
        PostImageOfPersonCardVC *card = [[PostImageOfPersonCardVC alloc] init];
//        card.returnBlock = ^(NSString *str){
//            self.bankStr = str;
//            [tableView reloadData];
//        };
        [self.navigationController pushViewController:card animated:YES];
    }else{
        PhotoImangVC *photo = [[PhotoImangVC alloc] init];
//        photo.returnBlock = ^(NSString *str){
//            self.imgStr = str;         
//            [tableView reloadData];
//        };
        [self.navigationController pushViewController:photo animated:YES];
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
